package com.cn.wanxi.servlet;

import com.cn.wanxi.model.CompanyModel;
import com.cn.wanxi.model.NavModel;
import com.cn.wanxi.service.CompanyService;
import com.cn.wanxi.service.NavService;

import javax.servlet.http.HttpServletRequest;

class CommonServlet {
    static void setReq(HttpServletRequest req) {
        CompanyService companyService = new CompanyService();
//        得到服务逻辑层返回的数据，因为我们需要将数据返回给前端页面
        CompanyModel companyModel = companyService.getCompanyModel();
//        将数据保存到一个容器里面，前端直接再里面去拿值
        req.setAttribute("companyModel", companyModel);

        NavService navService = new NavService();
        NavModel[] navModels = navService.getNavModel();
        req.setAttribute("navModels", navModels);
    }
}
